package httpserver

import (
	_ "fmt"
	"net/http"
	_ "net/http"
	"time"

	"example.com/dcache/cache"
)

func Server() {
	cache.Setup()
	r := InitRouter()
	r.Run(cache.GetLocalAddress())
	//r.Run("0.0.0.0:10240")

	s := &http.Server{
		Addr:         cache.GetLocalAddress(),
		Handler:      r,
		ReadTimeout:  5 * time.Second,
		WriteTimeout: 5 * time.Second,
		IdleTimeout:  20 * time.Second,
	}

	s.ListenAndServe()
}
